/*package com.suning.app.snpaasadmin.exception;



import com.opensymphony.xwork2.ActionSupport;
import com.suning.app.snpaasadmin.util.ExtJSResponse;

import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

@Provider
@Component
public class ExceptionHandler extends ActionSupport implements ExceptionMapper<Throwable> {

	*//**
     *//*
    private static final long serialVersionUID = 1L;
    
    private Map<String, Object> dataMap;
    *//**
*
*//*
	private Logger logger = Logger.getLogger(this.getClass());

	*//**
*
*//*
	public Response toResponse(Throwable exception) {
		logger.error("exception:", exception);
		dataMap = new HashMap<String, Object>();
		if(exception instanceof CloudFoundryApiException){
            ErrorBean bean=getErrorBeanFormCloudFoundryException(exception);
            dataMap.put("data", bean);
            return null;
        }
		
		*//**
         * bosh error
         *//*
        if(exception instanceof BoshException) {
            ErrorBean bean = getErrorBeanFormBoshException(exception);
            dataMap.put("data", bean);
            return null;
        }

        ErrorBean bean=new ErrorBean("2","系统出错了",2);
        dataMap.put("data", bean);
        return null;
	}

	private ErrorBean getErrorBeanFormCloudFoundryException(Throwable exception) {
		CloudFoundryApiException ex=(CloudFoundryApiException) exception;
		logger.error(ex.getCause());
		logger.error(ex.getErrMsg());
		logger.error(ex.getErrCode());
		return new ErrorBean(String.valueOf(ex.getErrCode()),ex.getErrMsg(),1);
	}
	
	private ErrorBean getErrorBeanFormBoshException(Throwable exception) {
	    BoshException boshException = (BoshException) exception;
	    logger.error(boshException.getCause());
	    logger.error(boshException.getErrMsg());
	    logger.error(boshException.getErrCode());
	    return new ErrorBean(String.valueOf(boshException.getErrCode()),boshException.getErrMsg(),1);
	}

    *//**
     * @return the dataMap
     *//*
    public Map<String, Object> getDataMap() {
        return dataMap;
    }

    *//**
     * @param dataMap the dataMap to set
     *//*
    public void setDataMap(Map<String, Object> dataMap) {
        this.dataMap = dataMap;
    }

}*/